package com.qingmu.club.minaapi.custom.logic;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.qingmu.club.minaapi.model.QueryLearnDiaryModel;
//import com.qingmu.club.minaapi.plus.entity.LearnDiary;
//import com.qingmu.club.minaapi.plus.entity.LearnDiaryReply;
import com.qingmu.club.minaapi.plus.service.ClubShopService;
//import com.qingmu.club.minaapi.plus.service.LearnDiaryReplyService;
//import com.qingmu.club.minaapi.plus.service.LearnDiaryService;
import com.qingmu.club.minaapi.utils.ResponseObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

@Component
public class LearnDiaryLogic {

//    @Autowired
//    LearnDiaryService learnDiaryService;
//
//    @Autowired
//    LearnDiaryReplyService learnDiaryReplyService;

    @Autowired
    ClubShopService clubShopService;


    /**
     * 查询门店对应的学习日记
     * @param shopId
     * @param page
     * @param pageSize
     * @return
//     */
//    public List<QueryLearnDiaryModel> queryShopDiary(String shopId,Integer page,Integer pageSize){
//
//        if(page==null){
//            page=0;
//        }
//        if(pageSize==null){
//            pageSize=10;
//        }
//
//        QueryWrapper<LearnDiary> qw = new QueryWrapper<>();
//        qw.eq(LearnDiary.SHOP_ID,shopId);
//        qw.orderByDesc(LearnDiary.CREATE_TIME);
//
//        IPage<LearnDiary> iPage = learnDiaryService.page(new Page<>(page,pageSize),qw);
//        List<LearnDiary> learnDiaryList = iPage.getRecords();
//
//        List<QueryLearnDiaryModel> results = new ArrayList();
//        for(LearnDiary learnDiary :learnDiaryList){
//            QueryLearnDiaryModel item = new QueryLearnDiaryModel();
//            BeanUtils.copyProperties(learnDiary, item);
//
//            QueryWrapper<LearnDiaryReply> lrdFrist = new QueryWrapper<>();
//            lrdFrist.eq(LearnDiaryReply.LEARN_DIARY_ID,learnDiary.getId());
//            List<LearnDiaryReply> replyList = this.learnDiaryReplyService.list(lrdFrist);
//            item.setReplyList(replyList);
//
//            results.add(item);
//        }
//        return results;
//    }


//    /**
//     * 查询会员对应的学习日记
//     * @param staffId
//     * @param userId
//     * @param page
//     * @param pageSize
//     * @return
//     */
//    public List<QueryLearnDiaryModel> queryMemberLearnDiary(String staffId,String userId,Integer page,Integer pageSize){
//
//
//    }
}
